/**
 * @author Dragon Wu
 * @since 2025/1/12 20:18
 */
import {app, BrowserWindow} from "electron";
import setApplicationMenu from "@/app/menu";
import {PRINT_APP_INFO} from "@/config";
import {appInfo} from "@/config/appInfo";

// 禁用启动的警告
process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true";

// 内嵌app的链接
const APP_URL = "http://localhost:3000";

// 挂载electron应用
app.on("ready", () => {
    const mainWindow = new BrowserWindow({
        width: 1200,
        height: 800,
        icon: "./public/assets/img/favicon.ico",    // 应用图标
        title: "XLODA"                              // 应用标题
    })

    mainWindow.loadURL(APP_URL).then()

    // todo 打开开发者工具 生产环境记得注释掉
    mainWindow.webContents.openDevTools()
});

// 设置菜单
setApplicationMenu();

// 打印软件启动日志
if (PRINT_APP_INFO) {
    console.log(appInfo)
}
